from storm.locals import *

__all__ = ["Devinfo", "DeviceOnline", "FwInfo","MediaTimes",
            "MovieNames","TerminalName", "UserInfo", "T_userinfo",
            "T_movienames","T_mediatimes"]

class Devinfo(object):
    __storm_table__ = "devinfo"
    id = Int(primary=True)
    serial = Unicode()
    fwversion = Unicode()
    name=Unicode()
    isinternal = Int()
    email = Unicode()
    phone = Unicode()
    addr= Unicode()
    qq = Unicode()
    webchat=Unicode()
    weibo = Unicode()
    firstonline=DateTime()
    lastupdate=DateTime()
    onlinedays=Int()

class DeviceOnline(object):
    __storm_table__ = "deviceonline"
    id = Int(primary=True)
    serial = unicode()
    recorddate = DateTime()


class FwInfo(object):
    __storm_table__ = "fwinfo"
    id = Int(primary=True)
    name = Unicode()
    isinternal = Int()
    fwversion = Unicode()
    fwurl = Unicode()

class MediaTimes(object):
    __storm_table__ = "mediatimes"
    id = Int(primary=True)
    terminalid = Unicode()
    videotime = Int()
    picturename = Int()
    documenttime = Int()
    musicetime = Int()
    startcount = Int()
    last_update = DateTime()
    baiduliveness = Int()
    recorddate = Date()
    openbyother = Int()

class MovieNames(object):
    __storm_table__ = "movienames"
    id = Int(primary = True)
    terminalid = Unicode()
    videoname = Unicode()
    watch_time= DateTime()
    duration = Int()
    filesize = Int()
    videolength = Unicode()
    resolution = Unicode()

class TerminalName(object):
    __storm_table__ = "terminalname"
    id = Int(primary=True)
    terminalname=Unicode()
    friendlyname=Unicode()

class UserInfo(object):
    __storm_table__ = "userinfo"
    id = Int(primary=True)
    terminalid = Unicode()
    deviceid = Unicode()
    terminaltype = Unicode()
    terminalversion = Unicode()
    clientversion = Unicode()
    baiduaccount = Unicode()
    last_update = DateTime()
    firmwareversion = Unicode()
    createdate = DateTime()
    storagetotal = Int()
    storagefree=Int()

class T_mediatimes(MediaTimes):
    __storm_table__ = "t_mediatimes"

class T_movienames(MovieNames):
    __storm_table__ = "t_movienames"

class T_userinfo(UserInfo):
    __storm_table__="t_userinfo"
